Skip to main content

Purchase Orders

Frequency:

Purchase order data and changes are required to be sent in near real-time.

Expected data:

Purchase order document to be created or updated.

Technical:

If a purchase order does not exist in DSWMS, it will be created.

If a purchase order already exists in DSWMS, the existing document will be updated with the new data.

details is the complete list of order lines. Lines are matched by line_number: existing lines are updated, new line numbers are added, and lines stored in DSWMS that are missing from the request are deleted.

An update is only possible until the start of the receive process on the DSWMS side for the respective purchase order. Once receiving has started, the request is rejected with Purchase Order Status doesn't allow updates. A fully received purchase order can never be updated.

If supplier_id is not known in DSWMS, the supplier is created from supplier_id and supplier_name, so supplier_name must always be sent.

split_group_id, plant_id and every article_id must already exist in DSWMS, and the article must have a unit of the quantity_unit_type_id that is sent. Otherwise the whole document is rejected with, for example, Split Group 1015 not found, Plant 102849 not found, Article 0001 not found or Article 0001 unit 2 not found.


POST https://{url}/v1/orders/purchase​

Create or update a purchase order.

Request Body​

The request body is a JSON object containing purchase order header fields and a details array with the order lines.

Purchase order fields:

NameTypeRequiredDescription
idstringYesPO unique identifier in ERP
type_idintegerYesPO type: 1 - Regular, 2 - JIT, 3 - XDOCK, 4 - Empties return, 5 - Material return
split_group_idstringYesSplit group unique identifier in ERP
plant_idstringYesPlant unique identifier in ERP
supplier_idstringYesSupplier unique identifier in ERP
supplier_namestringYesSupplier name
order_datestringYesPO order date, as unix timestamp (seconds or milliseconds) or yyyy-MM-ddTHH:mm:ss
delivery_datestringYesPO delivery date, as unix timestamp (seconds or milliseconds) or yyyy-MM-ddTHH:mm:ss
proposal_order_idstringNoProposal order identifier from DSO
detailsarrayYesArray of detail line objects for the purchase order

Detail object (inside details array):

NameTypeRequiredDescription
line_numberintegerYesPO detail line number
article_idstringYesArticle unique identifier in ERP
min_purchase_shelf_lifestringYesMinimum shelf life allowed to receive, as unix timestamp (seconds or milliseconds) or yyyy-MM-ddTHH:mm:ss
quantitynumberYesPO detail ordered quantity
quantity_unit_type_idintegerYesPO detail quantity unit type: 1 - base unit, 2 - warehouse unit, 3 - layer unit, 4 - pallet unit

Request Example​

{
"id": "3000437294",
"type_id": 1,
"split_group_id": "1015",
"plant_id": "102849",
"supplier_id": "917923956",
"supplier_name": "Coca Cola Latvia SIA",
"order_date": "1603979144",
"delivery_date": "1604340600",
"proposal_order_id": "1234567",
"details": [
{
"line_number": 100,
"article_id": "0001",
"min_purchase_shelf_life": "1605000600",
"quantity": 144,
"quantity_unit_type_id": 1
},
{
"line_number": 200,
"article_id": "0047",
"min_purchase_shelf_life": "1606023000",
"quantity": 60,
"quantity_unit_type_id": 2
}
]
}

Response​

200: OK — Success​

{
"success": true,
"message": null
}

400: Bad Request — Error​

{
"success": false,
"message": "Purchase Order Status doesn't allow updates"
}